package com.useeinfo.oa.modules.maintaining.biz;

import com.useeinfo.framework.extend.biz.CrudBiz;
import com.useeinfo.framework.sugar.data.QueryParam;
import com.useeinfo.oa.modules.maintaining.dao.MaintainDataDao;
import com.useeinfo.oa.modules.maintaining.entity.MaintainData;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MaintainDataBiz extends CrudBiz<MaintainDataDao, MaintainData> {

    /**
     * 删除无效维保内容
     * @return
     */
    public void deleteUselessData() {
        Long yesterdayTimeStamp = System.currentTimeMillis() - (24*60*60*1000);
        QueryParam queryParam = new QueryParam();
        queryParam.getSqlMap().put("noId","随便写什么");
        queryParam.getSqlMap().put("beforeTimeStamp",yesterdayTimeStamp+"");
        List<MaintainData> maintainDataList = this.findList(queryParam);
        if(CollectionUtils.isNotEmpty(maintainDataList)){
            for(MaintainData maintainData : maintainDataList){
                this.deleteLogic(maintainData);
            }
        }
    }
}
